﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using App.Core.Extensions;
using App.Domain;
using App.Web.ViewModels;
using App.Web.Utility;
using AutoMapper;
using System.Data;
using App.Web.ViewModels.UtilityModels;

namespace App.Web.Controllers
{
    public class ContentController : BaseController
    {
		private AppEntities _Context = new AppEntities();
        
		#region Constructors
		public ContentController()
		{
		}

        public ContentController(UserViewModel currentUser)
			: base(currentUser)
        {
        }
		#endregion Constructors

		#region Action Methods

        public ActionResult ViewContent(string ContentTitle="")
        {
            UtilityDAO dao = new UtilityDAO();
            App.Domain.DbParameter[] parameters = new[]{
                new App.Domain.DbParameter("@ContentID", (ContentTitle=="AboutUs")? ConfigReader.AboutUs : 
                                                            (ContentTitle=="OurServices")? ConfigReader.OurServices : 
                                                            (ContentTitle=="FAQ")? ConfigReader.FAQ : 
                                                            (ContentTitle=="ContactUs")? ConfigReader.ContactUs : 0)
            };
            DataSet ds = dao.GetDataSet(DbObject.SP.GET_CONTENT, parameters, true);
            ViewBag.ContentTitle = ds.Tables[0].Rows[0]["Title"].ToString();
            ViewBag.Summery = ds.Tables[0].Rows[0]["Summery"].ToString();
            ViewBag.Description = ds.Tables[0].Rows[0]["Description"].ToString();
            
            return View();
        }
		
		#endregion Action Methods
		
		#region Helper Methods

        #endregion			
    }
}
